package com.juren.eap.student.service.impl;

import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.juren.eap.student.Student;
import com.juren.eap.student.dao.StudentMapper;
import com.juren.eap.student.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhangtao
 * @since 2019-01-14
 */
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements IStudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public Student getStudentInfo(String id, String studentName) {
        QueryWrapper<Student> studentQueryWrapper = new QueryWrapper<>();
        studentQueryWrapper.eq("stu_id", id);
        if (!StringUtils.isBlank(studentName)){
            studentQueryWrapper.eq("stu_name", studentName);
        }
        return studentMapper.selectOne(studentQueryWrapper);
    }
}
